package com.crm.service;

import com.crm.entity.Right;
import com.crm.entity.Role;
import com.crm.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Map;

public interface IRoleService {
    public List<Role> findAllRoles();

    /**
     * 未提供权限操作的模块
     * 权限业务和角色相关
     * 统一设计在Role Service中
     */
    public List<Right> findAllRights();//根据角色查询权限

    public List<Right> findRightsByRole(Role role);//查询所有权限


    /**
     * 新增或修改
     *
     * @param role
     * @return
     */
    public Role saveRole(Role role);

    /**
     * 删除
     *
     * @param roleId
     */
    public void deleteRoleById(Integer roleId);

    public void deleteRole(Role role);

    /**
     * 按主键查询单条
     *
     * @param roleId
     * @return
     */
    public Role getRole(Integer roleId);

    /**
     * 按名称模糊查询并分页
     *
     * @param roleName
     * @param pageable
     * @return
     */
    public Page<Role> findRole(String roleName, Pageable pageable);


    Role findRoleByUsers(User user);

    public Map<String,String> loadFilterChainDefinitions();
    public void reloadFilterChainDefinitions();
}
